* <entry>font: Sans 15;</entry>
* </row>
* <row>
+ * <entry>margin-top</entry>
+ * <entry>integer</entry>
+ * <entry>#gint</entry>
+ * <entry>margin-top: 0;</entry>
+ * </row>
+ * <row>
+ * <entry>margin-left</entry>
+ * <entry>integer</entry>
+ * <entry>#gint</entry>
+ * <entry>margin-left: 1;</entry>
+ * </row>
+ * <row>
+ * <entry>margin-bottom</entry>
+ * <entry>integer</entry>
+ * <entry>#gint</entry>
+ * <entry>margin-bottom: 2;</entry>
+ * </row>
+ * <row>
+ * <entry>margin-right</entry>
+ * <entry>integer</entry>
+ * <entry>#gint</entry>
+ * <entry>margin-right: 4;</entry>
+ * </row>
+ * <row>
* <entry>margin</entry>
* <entry morerows="1"><literallayout>@width
* @vertical_width @horizontal_width
static GQuark provider_list_quark = 0;
static GdkRGBA fallback_color = { 1.0, 0.75, 0.75, 1.0 };
-static GtkBorder fallback_border = { 0 };
static void gtk_style_context_finalize (GObject *object);
{
GtkStyleContextPrivate *priv;
StyleData *data;
- const GValue *value;
- GtkBorder *b;
+ int top, left, bottom, right;
g_return_if_fail (margin != NULL);
- *margin = fallback_border;
-
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
priv = context->priv;
g_return_if_fail (priv->widget_path != NULL);
data = style_data_lookup (context);
- value = _gtk_style_properties_peek_property (data->store,
- "margin",
- state,
- NULL);
+ gtk_style_properties_get (data->store,
+ state,
+ "margin-top", &top,
+ "margin-left", &left,
+ "margin-bottom", &bottom,
+ "margin-right", &right,
+ NULL);
- if (value)
- {
- b = g_value_get_boxed (value);
- *margin = *b;
- }
+ margin->top = top;
+ margin->left = left;
+ margin->bottom = bottom;
+ margin->right = right;
}
/**
"padding-bottom", "padding-right");
}
+static GParameter *
+unpack_margin (const GValue *value,
+ guint *n_params)
+{
+ return unpack_border (value, n_params,
+ "margin-top", "margin-left",
+ "margin-bottom", "margin-right");
+}
+
+static void
+pack_margin (GValue *value,
+ GtkStyleProperties *props,
+ GtkStateFlags state)
+{
+ pack_border (value, props, state,
+ "margin-top", "margin-left",
+ "margin-bottom", "margin-right");
+}
+
/*** API ***/
static void
gtk_style_properties_register_property (NULL, pspec);
gtk_style_properties_register_property (NULL,
- g_param_spec_boxed ("margin",
+ g_param_spec_int ("margin-top",
+ "margin top",
+ "Margin at top",
+ 0, G_MAXINT, 0, 0));
+ gtk_style_properties_register_property (NULL,
+ g_param_spec_int ("margin-left",
+ "margin left",
+ "Margin at left",
+ 0, G_MAXINT, 0, 0));
+ gtk_style_properties_register_property (NULL,
+ g_param_spec_int ("margin-bottom",
+ "margin bottom",
+ "Margin at bottom",
+ 0, G_MAXINT, 0, 0));
+ gtk_style_properties_register_property (NULL,
+ g_param_spec_int ("margin-right",
+ "margin right",
+ "Margin at right",
+ 0, G_MAXINT, 0, 0));
+ _gtk_style_property_register (g_param_spec_boxed ("margin",
"Margin",
"Margin",
- GTK_TYPE_BORDER, 0));
+ GTK_TYPE_BORDER, 0),
+ NULL,
+ unpack_margin,
+ pack_margin);
gtk_style_properties_register_property (NULL,
g_param_spec_int ("padding-top",
"padding top",